package com.jack.design_patterns.structural.adapter.clazz;

import com.jack.design_patterns.structural.adapter.Player;
import com.jack.design_patterns.structural.adapter.Zh_JPTranslator;

/**
 * 继承的方式：类结构模型，适配转换到了翻译器的功能上
 */
public class JPMoviePlayerAdapter extends Zh_JPTranslator implements Player {

    // 被适配对象
    Player target;

    public JPMoviePlayerAdapter(Player player) {
        target = player;
    }

    @Override
    public String play() {
        String subtitleContent = target.play();
        // 转换字幕
        String translate = translate(subtitleContent);
        System.out.println("日本語の字幕：" + translate);
        return subtitleContent;
    }
}
